<?php
/**
 * Created by PhpStorm.
 * User: wei
 * Date: 2016/7/12
 * Time: 9:43
 */
namespace Admin\Controller;
use Admin\Model\StatisticsModel;
class BasisSetController extends CommonController {
    protected function _initialize()
    {
        parent::_initialize();
        $this->breadcrumb1 = '基础数据管理';
        $this->breadcrumb2 = '基础数据设置';
        $this->url = U('BasisSet/index');
    }

    public function index(){
        $menu_id=$_GET['id'];
        $jur=jur_str($menu_id,$this->user_id);
        $list=M('basisset')->where('status=1')->select();
        $this->assign('list',$list);

        $this->assign('update',$jur['is_update']);// 赋值数据集
        $this->assign('delete',$jur['is_delete']);// 赋值数据集
        $this->display();
    }

    public function upda(){
        $id=I('post.id','','int');
        $url=I('post.url');
        $rule = '/\b(([\w-]+:\/\/?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/';
        $result=array();
        preg_match($rule,$url,$result);
        if(empty($result)){
            echo 1;exit;
        }else{
            $where['id']=$id;
            $s['url']=$url;
            M('basisset')->where($where)->save($s);
            echo 2;exit;
        }

    }
}